package org.wangblue.concrete_visitor;

import org.wangblue.concrete_elements.Book;
import org.wangblue.concrete_elements.Elect;
import org.wangblue.visitor.Visitor;

/**
 * @description: 信息访问者
 * @author: WangBlue (wangjiping596@gmail.com)
 * @create: 2024-10-02 22:11
 **/
public class InfoVisitor extends Visitor {

    @Override
    public void visit(Book book) {
        System.out.println("书籍: " + book.getTitle() + ", 价格: " + book.getPrice());
    }

    @Override
    public void visit(Elect electronics) {
        System.out.println("电子产品: " + electronics.getModel() + ", 价格: " + electronics.getPrice());
    }
}
